<template>
  <!-- 合作伙伴 -->
  <div class="partner">
    <el-table :data="partnerData" style="width: 100%">
      <el-table-column prop="companyName" label="企业名称"></el-table-column>
      <el-table-column prop="eMail" label="企业邮箱"></el-table-column>
      <el-table-column label="工商执照">
        <template slot-scope="{row}">
          <img
            :src="row.bizLicense"
            class="bizLicense"
            v-showImgArr="{list:[row.bizLicense],ind:0}"
          />
        </template>
      </el-table-column>
      <el-table-column prop="contacts" label="企业联系人"></el-table-column>
      <el-table-column prop="phone" label="手机号"></el-table-column>
      <el-table-column prop="idCard" label="证件号"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="{row}">
          <el-button type="text" v-if="row.state==1" @click="toggle(0,row.id)">关闭赛事资格</el-button>
          <el-button type="text" v-if="row.state==0" @click="toggle(1,row.id)">开通赛事资格</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      partnerData: [],
    };
  },
  methods: {
    getAll() {
      this.$axios
        .get("/org/client/getCompany/" + this.$Base64.encode(this.$orgId))
        .then((res) => {
          let rr = res.data.data;
          this.partnerData = rr;
        });
    },
    toggle(s, id) {
      this.$confirm("确认修改赛事发布资格", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let o = s + "&" + id;
          o = this.$Base64.encode(o);
          this.$axios.post("/org/client/updateSate/" + o).then((res) => {
            this.$message.success("操作成功");
            this.getAll();
          });
        })
        .catch(() => {
          this.$message.info("已取消修改");
        });
    },
  },
  created() {
    this.getAll();
  },
};
</script>
<style scoped>
/* @import url(); 引入公共css类 */
.partner {
  width: 95%;
  margin: 20px auto;
  padding: 20px;
  border-radius: 10px;
  background-color: #fff;
}
.bizLicense {
  width: 100px;
  cursor: pointer;
}
</style>